package com.xuxu.member.service.impl;

import com.xuxu.member.dao.UsersDao;
import com.xuxu.member.entity.UsersEntity;
import com.xuxu.member.service.UsersService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.Map;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.xuxu.common.utils.PageUtils;
import com.xuxu.common.utils.Query;


@Service
public class UsersServiceImpl extends ServiceImpl<UsersDao, UsersEntity> implements UsersService {
    @Autowired
    UsersDao usersDao;
    @Override
    public PageUtils queryPage(Map<String, Object> params) {
        IPage<UsersEntity> page = this.page(
                new Query<UsersEntity>().getPage(params),
                new QueryWrapper<UsersEntity>()
        );

        return new PageUtils(page);
    }

    @Override
    public UsersEntity selectUserByName(UsersEntity usersEntity) {
        QueryWrapper<UsersEntity> wrapper = new QueryWrapper<>();
        wrapper.eq("uname", usersEntity.getUname());
        UsersEntity users = usersDao.selectOne(wrapper);
        return users;
    }

}